import { Book } from '@/types/book'
import { Pagination, PageResult, PageParam, ApproveReqDto } from '@/types/global'
import { Order } from '@/types/order'
import { http } from '@/utils/http'

type orderListReq = PageParam & { direction: number; status?: string } // 定义类型 类型是Pagination的属性 + 自定义属性

export const borrowApi = (data?: Order) => {
  return http.post<Order>('/bk/order/borrow', data)
}

export const updateStatusApi = (data?: ApproveReqDto) => {
  return http.post<Order>('/bk/order/borrowProcess', data)
}

export const myOrderListApi = (param: orderListReq) => {
  return http.get<PageResult<Order>>('/bk/order/myOrderList', param)
}
